﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CCoC3DGeneratorCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Windows.Forms;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands;

public class CCoC3DGeneratorCmd : TxButtonCommand
{
  private CCoC3DGeneratorEnabler m_enabler;

  public CCoC3DGeneratorCmd() => this.m_enabler = new CCoC3DGeneratorEnabler();

  public virtual void Execute(object cmdParams)
  {
    if (!this.m_enabler.Enable)
      return;
    Cursor current = Cursor.Current;
    try
    {
      Cursor.Current = Cursors.WaitCursor;
      CApC3DManagerApp generatorApp = new CApC3DManagerApp();
      generatorApp.Initialize();
      if (!generatorApp.ThreeDPDFLicense)
      {
        int num1 = (int) TxMessageBox.Show(StringTable.CREATE_3D_DOCUMENTATION_NO_VALID_3DPDF_LICENSE, StringTable.CREATE_3D_DOCUMENTATION_CMD_NAME, MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
      else if (generatorApp.DoRootsExistOnServer())
      {
        DialogResult dialogResult = DialogResult.Yes;
        if (generatorApp.DoRootsHave3DData())
          dialogResult = TxMessageBox.Show(CApC3DUtils.GetResourceManager().GetString("CREATE_3D_DOCUMENTATION_OVERWRITE_MSG"), base.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        if (dialogResult != DialogResult.Yes)
          return;
        ((Control) new CUiC3DGeneratorForm(generatorApp)).Show();
      }
      else
      {
        int num2 = (int) TxMessageBox.Show(CApC3DUtils.GetResourceManager().GetString("CREATE_3D_DOCUMENTATION_ROOTS_NOT_EXIST"), base.Name, MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
    }
    finally
    {
      Cursor.Current = current;
    }
  }

  public virtual string Category
  {
    get => CApC3DUtils.GetResourceManager().GetString("CREATE_3D_DOCUMENTATION_CMD_CATEGORY");
  }

  public virtual string Name
  {
    get => CApC3DUtils.GetResourceManager().GetString("CREATE_3D_DOCUMENTATION_CMD_NAME");
  }

  public virtual string Bitmap
  {
    get => CApC3DUtils.GetResourceManager().GetString("CREATE_3D_DOCUMENTATION_CMD_BITMAP");
  }

  public virtual string Description
  {
    get => CApC3DUtils.GetResourceManager().GetString("CREATE_3D_DOCUMENTATION_CMD_DESCRIPTION");
  }

  public virtual string Tooltip
  {
    get => CApC3DUtils.GetResourceManager().GetString("CREATE_3D_DOCUMENTATION_CMD_TOOLTIP");
  }

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_enabler;

  public virtual bool Connect() => true;
}
